﻿function GetArticles() {
    jQuery.support.cors = true;
    $.ajax({
        url: 'http://localhost:4367/api/Article',
        type: 'GET',
        dataType: 'json',
        success: function (data) {
            alert(data);
            WriteArticleResponse(data);
        },
        error: function (x, y, z) {
            alert(x + ' ' + y + ' ' + z);
        }
    });
}

function WriteArticleResponse(data) {
    var result = '<ul>';
    $.each(data, function (index, article) {
        result += '<li>' + article.ArticleID;
    });
    result += '</ul>';
    $('#showlist').html(result);
}

function GetExclusions() {
    jQuery.support.cors = true;
    $.ajax({
        url: 'http://localhost:4367/api/KeywordExclusion',
        type: 'GET',
        dataType: 'json',
        success: function (data) {
            alert(data);
            WriteExclusionResponse(data);
        },
        error: function (x, y, z) {
            alert(x + ' ' + y + ' ' + z);
        }
    });
}

function WriteExclusionResponse(data) {
    var result = '<ul>';
    $.each(data, function (index, keyword) {
        result += '<li>' + keyword.ExclusionId;
    });
    result += '</ul>';
    $('#showlist').html(result);
}